package com.zdb.controller;

import com.zdb.common.Result;
import com.zdb.pojo.Tags;
import com.zdb.service.TagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/tags")
@RestController
public class TagController {
    @Autowired
    private TagService tagService;
    @GetMapping()
    public Result getTags() {
        List<Tags> tags=tagService.getTags();
        return Result.sucess("标签列表",tags);
    }
    @GetMapping("/{id}")
    public Result getTag(@PathVariable("id") int id) {
        return Result.sucess("当前分类标签列表",tagService.getTagsByCId(id));
    }
}
